home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-M68K / PROCESSO.{_H < prev    next >
Text File  |  1999-09-17  |  3KB  |  113 lines

  1. /*
  2.  * include/asm-m68k/processor.h
  3.  *
  4.  * Copyright (C) 1995 Hamish Macdonald
  5.  */
  6.  
  7. #ifndef __ASM_M68K_PROCESSOR_H
  8. #define __ASM_M68K_PROCESSOR_H
  9.  
  10. #include <asm/segment.h>
  11. #include <asm/fpu.h>
  12.  
  13. /*
  14.  * User space process size: 3.75GB. This is hardcoded into a few places,
  15.  * so don't change it unless you know what you are doing.
  16.  */
  17. #define TASK_SIZE    (0xF0000000UL)
  18.  
  19. /* This decides where the kernel will search for a free chunk of vm
  20.  * space during mmap's.
  21.  */
  22. #define TASK_UNMAPPED_BASE    0xC0000000UL
  23. #define TASK_UNMAPPED_ALIGN(addr, off)    PAGE_ALIGN(addr)
  24.  
  25. /*
  26.  * Bus types
  27.  */
  28. #define EISA_bus 0
  29. #define MCA_bus 0
  30.  
  31. /* 
  32.  * if you change this structure, you must change the code and offsets
  33.  * in m68k/machasm.S
  34.  */
  35.    
  36. struct thread_struct {
  37.     unsigned long  ksp;        /* kernel stack pointer */
  38.     unsigned long  usp;        /* user stack pointer */
  39.     unsigned short sr;        /* saved status register */
  40.     unsigned short fs;        /* saved fs (sfc, dfc) */
  41.     unsigned long  crp[2];        /* cpu root pointer */
  42.     unsigned long  esp0;        /* points to SR of stack frame */
  43.     unsigned long  fp[8*3];
  44.     unsigned long  fpcntl[3];    /* fp control regs */
  45.     unsigned char  fpstate[FPSTATESIZE];  /* floating point state */
  46. };
  47.  
  48. #define INIT_MMAP { &init_mm, 0, 0x40000000, NULL, __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED), VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
  49.  
  50. #define INIT_TSS  { \
  51.     sizeof(init_stack) + (unsigned long) init_stack, 0, \
  52.     PS_S, __KERNEL_DS, \
  53.     {0, 0}, 0, {0,}, {0, 0, 0}, {0,}, \
  54. }
  55.  
  56. /*
  57.  * Do necessary setup to start up a newly executed thread.
  58.  */
  59. static inline void start_thread(struct pt_regs * regs, unsigned long pc,
  60.                 unsigned long usp)
  61. {
  62.     /* reads from user space */
  63.     set_fs(USER_DS);
  64.  
  65.     regs->pc = pc;
  66.     regs->sr &= ~0x2000;
  67.     wrusp(usp);
  68. }
  69.  
  70. /* Free all resources held by a thread. */
  71. static inline void release_thread(struct task_struct *dead_task)
  72. {
  73. }
  74.  
  75. extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
  76.  
  77. #define copy_segments(nr, tsk, mm)    do { } while (0)
  78. #define release_segments(mm)        do { } while (0)
  79. #define forget_segments()        do { } while (0)
  80.  
  81. /*
  82.  * Free current thread data structures etc..
  83.  */
  84. static inline void exit_thread(void)
  85. {
  86. }
  87.  
  88. /*
  89.  * Return saved PC of a blocked thread.
  90.  */
  91. extern inline unsigned long thread_saved_pc(struct thread_struct *t)
  92. {
  93.     extern void scheduling_functions_start_here(void);
  94.     extern void scheduling_functions_end_here(void);
  95.     struct switch_stack *sw = (struct switch_stack *)t->ksp;
  96.     /* Check whether the thread is blocked in resume() */
  97.     if (sw->retpc > (unsigned long)scheduling_functions_start_here &&
  98.         sw->retpc < (unsigned long)scheduling_functions_end_here)
  99.         return ((unsigned long *)sw->a6)[1];
  100.     else
  101.         return sw->retpc;
  102. }
  103.  
  104. /* Allocation and freeing of basic task resources. */
  105. #define alloc_task_struct() \
  106.     ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
  107. #define free_task_struct(p)    free_pages((unsigned long)(p),1)
  108.  
  109. #define init_task    (init_task_union.task)
  110. #define init_stack    (init_task_union.stack)
  111.  
  112. #endif
  113.